package com.ptu.vo;

import com.ptu.entity.Comment;
import com.ptu.entity.OrderItem;

import java.math.BigDecimal;
import java.util.List;

public class OrderVO {
    //订单id
    private Long id;
    //订单号
    private String orderNo;
    //创建时间
    private String createTime;
    //订单状态
    private Integer status;
    //支付金额
    private BigDecimal actualAmount;
    //订单项
    private List<OrderItem> orderItems;

    // 收货地址信息
    private Long addressId;
    private String province;
    private String city;
    private String district;
    private String detailAddress;

    // 新增：获取完整收货地址的方法
    public String getFullAddress() {
        return (province == null ? "" : province) +
                (city == null ? "" : city) +
                (district == null ? "" : district) +
                (detailAddress == null ? "" : detailAddress);
    }

    // 新增：地址字段的 getter/setter 方法
    public Long getAddressId() {return addressId;}

    public void setAddressId(Long addressId) {
        this.addressId = addressId;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getDetailAddress() {
        return detailAddress;
    }

    public void setDetailAddress(String detailAddress) {
        this.detailAddress = detailAddress;
    }

    private Comment  comment;

    public Comment getComment() {
        return comment;
    }

    public void setComment(Comment comment) {
        this.comment = comment;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public BigDecimal getActualAmount() {
        return actualAmount;
    }

    public void setActualAmount(BigDecimal actualAmount) {
        this.actualAmount = actualAmount;
    }

    public List<OrderItem> getOrderItems() {
        return orderItems;
    }

    public void setOrderItems(List<OrderItem> orderItems) {
        this.orderItems = orderItems;
    }
    // 新增：包含地址信息的构造方法
    public OrderVO(Long id, String orderNo, String createTime, Integer status,
                   BigDecimal actualAmount, List<OrderItem> orderItems,
                   Comment comment, Long addressId, String province,
                   String city, String district, String detailAddress) {
        this.id = id;
        this.orderNo = orderNo;
        this.createTime = createTime;
        this.status = status;
        this.actualAmount = actualAmount;
        this.orderItems = orderItems;
        this.comment = comment;
        this.addressId = addressId;
        this.province = province;
        this.city = city;
        this.district = district;
        this.detailAddress = detailAddress;
    }

    public OrderVO() {
    }

    @Override
    public String toString() {
        return "OrderVO{" +
                "id=" + id +
                ", orderNo='" + orderNo + '\'' +
                ", createTime='" + createTime + '\'' +
                ", status=" + status +
                ", actualAmount=" + actualAmount +
                ", orderItems=" + orderItems +
                ", comment=" + comment +
                ", addressId=" + addressId +
                ", province='" + province + '\'' +
                ", city='" + city + '\'' +
                ", district='" + district + '\'' +
                ", detailAddress='" + detailAddress + '\'' +
                '}';
    }
}
